<?php

use think\migration\Seeder;

class User extends Seeder
{
    /**
     * Run Method.
     *
     * Write your database seeder using this method.
     *
     * More information on writing seeders is available here:
     * http://docs.phinx.org/en/latest/seeding.html
     */
    public function run(): void
    {
        $this->insert('user', $this->adminData());

    }

    protected function adminData()
    {
        return [
            'user_name' => 'admin',
            'password' => "ac21de07a12af5fb60f0e1c8caf36f1a66420876",
            'head' => '/static/admin/images/profile_small.jpg',
            'last_login_ip' => '127.0.0.1',
            'role_id' => '1',
            'status' => '1',
            'pass_salt' => 'RUbIYr'
        ];
    }

    private function createData(): array
    {

        $faker = \Faker\Factory::create('zh_CN');

        $arr = [];
        for ($i = 0; $i < 10; $i++) {
            $arr[] = [
                'user_name' => $faker->name,
                'passwd' => md5('123456')
            ];
        }

        return $arr;

    }
}